<div class="app-body">
  <main class="main d-flex align-items-center">
    <div class="container">
      <div class="row">
        <div class="col-md-8 mx-auto">
          <div class="card p-4">
            <div class="card-header">Test Login Credentials</div>
            <div class="card-body">
              <button type="button" class="btn btn-link px-0" (click)="fillAdminCredentials()">Admin</button>: admin@domain.com
              (pa55word)<br />
              <button type="button" class="btn btn-link px-0" (click)="fillUserCredentials()">User</button>: user@domain.com (pa55word)<br />
            </div>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-md-8 mx-auto">
          <div class="card-group">
            <div class="card p-4">
              <div class="card-body">
                <form [formGroup]="loginForm" (ngSubmit)="onSubmit()" class="login-form">
                  <h1>Login</h1>
                  <p class="text-muted">Sign In to your account</p>
                  <div class="input-group mb-3">
                    <div class="input-group-prepend">
                      <span class="input-group-text"><i class="icon-user"></i></span>
                    </div>
                    <input
                      type="text"
                      formControlName="username"
                      class="form-control"
                      placeholder="Username"
                      autocomplete="username"
                      required
                    />
                  </div>
                  <div *ngIf="f.username.invalid && (f.username.dirty || f.username.touched)" class="mb-4 alert alert-danger">
                    Username not valid
                  </div>
                  <div class="input-group mb-4">
                    <div class="input-group-prepend">
                      <span class="input-group-text"><i class="icon-lock"></i></span>
                    </div>
                    <input
                      formControlName="password"
                      type="password"
                      class="form-control"
                      placeholder="Password"
                      autocomplete="current-password"
                      required
                    />
                  </div>
                  <div *ngIf="f.password.invalid && (f.password.dirty || f.password.touched)" class="mb-4 alert alert-danger">
                    Password not valid
                  </div>
                  <div class="row">
                    <div class="col-6">
                      <button type="submit" [disabled]="!loginForm.valid || loading" class="btn btn-primary px-4">
                        Login
                        <img
                          *ngIf="loading"
                          src=""
                        />
                      </button>
                    </div>
                    <div class="col-6 text-right"><button type="button" class="btn btn-link px-0">Forgot password?</button></div>
                  </div>
                  <div class="row">
                    <div class="col-12 mt-2">
                      <div *ngIf="error" class="mb-4 alert alert-danger">{{ error }}</div>
                    </div>
                  </div>
                </form>
              </div>
            </div>

            <div class="card text-white bg-primary py-5 d-md-down-none" style="width:44%">
              <div class="card-body text-center">
                <div>
                  <h2>Sign up</h2>
                  <p>
                    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
                    aliqua.
                  </p>
                  <a routerLink="/register"><button type="button" class="btn btn-primary active mt-3">Register Now!</button></a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="row mt-4">
        <div class="col-md-4 mx-auto">
          <div class="card mx-4">
            <div class="card-body p-4">
              <h2>Social Login</h2>
              <button class="btn btn-block btn-facebook mt-2" type="button" (click)="onFacebookLogin()"><span>facebook</span></button>
              <button class="btn btn-block btn-twitter mt-2" type="button" (click)="onTwitterLogin()"><span>twitter</span></button>
              <button class="btn btn-block btn-google-plus mt-2" type="button" (click)="onGoogleLogin()"><span>google</span></button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </main>
</div>
